{include admin.inc.header}

{include admin.inc.top}
<style>
	.select2-container {
		min-width: 150px;
	}
</style>

<div class="container-fluid content-body">
	<div class="main">
		{include admin.inc.menu}

		<section class="right-section" id="right-section">
			<!-- start of inner-frame -->
			<div class="inner-iframe">

				<ul class="breadcrumb">
					<li>
						<i class="glyphicon glyphicon-home"></i>
						<span>当前位置：</span>
						<a href="#">{$breadcrumb[0]}</a>
						<i class="glyphicon glyphicon-chevron-right"></i>
						<a href="#">{$breadcrumb[1]}</a>
					</li>
				</ul>

				<!-- Nav tabs -->
				<!-- Nav tabs -->
				<ul class="nav nav-tabs">
					<li class="active"><a href="{$index_url}"><i class="glyphicon glyphicon-th-list"></i> 报价列表</a></li>
					{if $tab}
					<li><a href="javascript:void(0);" id="content-add" ><i class="glyphicon glyphicon-plus"></i> {if $has_quote}编辑行情数据{else}新建行情数据{/if}</a></li>
					{/if}
				</ul>

				<div class="inner-container">

					<!-- search form start -->
					<form class="form-inline form-search" role="form" id="search-form" autocomplete="off">

						<div style="margin-bottom: 10px">
							<a href="javascript:;" data-tab="" class="ajaxTab btn {if !$tab or $tab==""}btn-primary{else}btn-default{/if}">
								全部
							</a>
							<a href="javascript:;" data-tab="PVC" class="ajaxTab btn {if $tab=="PVC"}btn-primary{else}btn-default{/if}">
								PVC
							</a>
							<a href="javascript:;" data-tab="PP" class="ajaxTab btn {if $tab=="PP"}btn-primary{else}btn-default{/if}">
								PP
							</a>
							<a href="javascript:;" data-tab="PET" class="ajaxTab btn {if $tab=="PET"}btn-primary{else}btn-default{/if}">
								PET
							</a>
							<a href="javascript:;" data-tab="LLDPE" class="ajaxTab btn {if $tab=="LLDPE"}btn-primary{else}btn-default{/if}">
								LLDPE
							</a>
							<a href="javascript:;" data-tab="ABS" class="ajaxTab btn {if $tab=="ABS"}btn-primary{else}btn-default{/if}">
								ABS
							</a>
							<a href="javascript:;" data-tab="HIPS" class="ajaxTab btn {if $tab=="HIPS"}btn-primary{else}btn-default{/if}">
								HIPS
							</a>
							<a href="javascript:;" data-tab="HDPE" class="ajaxTab btn {if $tab=="HDPE"}btn-primary{else}btn-default{/if}">
								HDPE
							</a>
							<a href="javascript:;" data-tab="PC" class="ajaxTab btn {if $tab=="PC"}btn-primary{else}btn-default{/if}">
								PC
							</a>
							<a href="javascript:;" data-tab="GPPS" class="ajaxTab btn {if $tab=="GPPS"}btn-primary{else}btn-default{/if}">
								GPPS
							</a>

						</div>

						<div class="form-group" id="s_addtime">
							<div class="input-group">
								<div class="input-group-addon">日期</div>
								<div class="form-inline">
									<input type="hidden" name="tab" value="{$tab}">
									<input type="text" name="starttime" value="{$starttime}" class="form-control input-sm mdate" placeholder="开始日期">
									<input type="text" name="endtime" value="{$endtime}" class="form-control input-sm mdate" placeholder="结束日期">
								</div>
							</div>
						</div>

						<button type="submit" class="btn btn-success btn-sm">
							<i class="glyphicon glyphicon-search"></i> 搜索
						</button>
					</form><!-- END search form -->


					<form id="J_List_Form" autocomplete="off">
						<div class="table-responsive">
							<table class="table table-bordered table-hover" id="J_List_Table">
								<thead>
								<tr>
									<th width="20"><input type="checkbox" class="icheck check-all" /></th>
									<th style="width: 120px">品名</th>
									<th style="width: 150px">厂家</th>
									<th style="width: 120px">牌号</th>
									<th>昨日价格</th>
									<th>今日价格</th>
									<th>涨跌</th>
									<th>日期</th>
									<th>添加人</th>
									<th>操作</th>
								</tr>
								</thead>
								<tbody>
								{if empty($items)}
								<tr>
									<td class="no-records text-center">{$noRecords}</td>
								</tr>
								{/if}
								{loop $items $value}
								<tr>
									<td><input type="checkbox" class="icheck" name="ids[]" id="checkbox_row_{$value[id]}" /></td>
									<td>{$value[product_name]}</td>
									<td>{$value[factory_name]}</td>
									<td>{$value[brand_name]}</td>
									<td>{$value[yesterday_price]?$value[yesterday_price]:'--'}</td>
									<td>{$value[price]}</td>
									<td>
										{if $value[is_diff]}
										{if $value[difference]>=0}
										<span class="btn btn-danger">{$value[difference]} <i class="glyphicon glyphicon-arrow-up"></i></span>
										{else}
										<span class="btn btn-success">{$value[difference]} <i class="glyphicon glyphicon-arrow-down"></i></span>
										{/if}
										{else}
										--
										{/if}

									</td>
									<td>{$value[addtime]}</td>
									<td>{$value[manager_name]}</td>
									<td>
										<a href="/admin/quoteData/softDelete?id={$value[id]}" class="btn btn-danger btn-xs item-remove">
											<i class="glyphicon glyphicon-trash"></i> 删除</a>
									</td>
								</tr>
								{/loop}
								</tbody>
							</table>
						</div>
					</form>

					<div class="text-right">
						{$pagemenu}
					</div>

				</div>

			</div><!-- end of inner -->
		</section>

	</div>
</div>

{include admin.inc.footer}
<script type="text/html" id="content-add-template">

	<form role="form" class="content-add-form" id="content-add-form" autocomplete="off" >

		<div class="table-responsive">
			<table class="table table-bordered table-hover" id="J_List_Table_Add" >
				<thead>
				<tr>
					<th style="width: 120px">品名</th>
					<th style="width: 150px">厂家</th>
					<th style="width: 120px">牌号</th>
					<th>昨日价格</th>
					<th>今日价格</th>
					<th>操作</th>
				</tr>
				</thead>
				<tbody class="add_temp_table">
				{if empty($alertRes)}
					<tr class="empty_line" id="first_empty_line">
						<td class="">
							<!--<select name="data[product_name_new][]" class="form-control input-sm search-options" required="" data-value="{$sel_value}" readonly >
								<option value="">选择品名</option>
								<option value='5' data-type-id='1' {if $sel_value == 5}selected{/if}>PVC</option>
								<option value='6' data-type-id='1' {if $sel_value == 6}selected{/if}>PP</option>
								<option value='56' data-type-id='1' {if $sel_value == 56}selected{/if}>PET</option>
								<option value='4' data-type-id='1' {if $sel_value == 4}selected{/if}>LLDPE</option>
								<option value='1' data-type-id='1' {if $sel_value == 1}selected{/if}>ABS</option>
								<option value='7' data-type-id='1' {if $sel_value == 7}selected{/if}>HIPS</option>
								<option value='3' data-type-id='1' {if $sel_value == 3}selected{/if}>HDPE</option>
								<option value='9' data-type-id='2' {if $sel_value == 9}selected{/if}>PC</option>
								<option value='2' data-type-id='1' {if $sel_value == 2}selected{/if}>GPPS</option>
							</select>-->
							<span >{$tab}</span>
							<input type='hidden' name='data[product_name_new_text][]' value='{$tab}'>
							<input type='hidden' name='data[product_name_new][]' value='{$sel_value}'>
						</td>

						<td>
							<select name="data[factory_name_new][]" class="form-control input-sm search-options select2 col-sm-1" required>
								<option value="">选择厂家</option>
								{loop $factory $vv}
								<option value="{$vv['id']}" data-type-id="{$type_id}">{$vv['name']}</option>
								{/loop}
							</select>
							<input type='hidden' name='data[factory_name_new_text][]' value=''>
						</td>
						<td class="">
							<select name="data[brand_name_new][]" class="form-control input-sm search-options select2 col-sm-1" required>
								<option value="">选择牌号</option>
							</select>
							<input type='hidden' name='data[brand_name_new_text][]' value=''>
						</td>
						<td class="">
							<!--<input type="text" dtype="value" min-value="0.01" max-value="9999999.99" name="data[yesterday_new][]"  maxlength="11">-->
						</td>
						<td class="">
							<input type="text" dtype="value" min-value="0.01" max-value="9999999.99" name="data[today_new][]" required maxlength="11">
						</td>
						<td class="">
							<a href="javascript:;" class="btn btn-danger btn-xs delete_self">
								<i class="glyphicon glyphicon-trash"></i> 删除</a>
						</td>
					</tr>
				{/if}
				{if $has_quote}
				{loop $alertRes $value}
					<tr class="empty_line">
						<td>{$value[product_name]}</td>
						<td>{$value[factory_name]}</td>
						<td>{$value[brand_name]}</td>
						<td>{$value[yesterday_price]}</td>
						<td>
							<input type="hidden" value="{$has_quote}" name="has_quote">
							<input type="hidden" name="today_id[]" value="{$value[id]}">
							<input type="hidden" name="pfb[]" value="{$value[pfb]}">
							<input type="text" name="today[]" dtype="value" min-value="0.01" max-value="9999999.99" required maxlength="11" value="{$value[price]}"></td>
						<td>
							<a href="javascript:;" class="btn btn-danger btn-xs delete_self">
								<i class="glyphicon glyphicon-trash"></i> 删除</a>
						</td>
					</tr>
				{/loop}
				{else}
				{loop $alertRes $value}
				<tr class="empty_line">
					<td>{$value[product_name]}</td>
					<td>{$value[factory_name]}</td>
					<td>{$value[brand_name]}</td>
					<td>{$value[price]}</td>
					<td>
						<input type="hidden" name="today_id[]" value="{$value[id]}">
						<input type="hidden" name="pfb[]" value="{$value[pfb]}">
						<input type="text" name="today[]" dtype="value" min-value="0.01" max-value="9999999.99" required maxlength="11" value=""></td>
					<td>
						<a href="javascript:;" class="btn btn-danger btn-xs delete_self">
							<i class="glyphicon glyphicon-trash"></i> 删除</a>
					</td>
				</tr>
				{/loop}
				{/if}
				</tbody>
			</table>
		</div>
	</form>

	<button type="submit" class="btn btn-success btn-sm add_one_line pull-right" style="margin-bottom: 20px">
		增加一行
	</button>
</script>

<script type="text/html" id="empty_line-template">
	<tr class="empty_line" id="add_empty_line">
		<td class="">
			<!--<select name="data[product_name_new][]" class="form-control input-sm search-options" required=""
					data-value="{$sel_value}" readonly="true">
				<option value="">选择品名</option>
				<option value='5' data-type-id='1' {if $sel_value== 5}selected{/if}>PVC</option>
				<option value='6' data-type-id='1' {if $sel_value== 6}selected{/if}>PP</option>
				<option value='56' data-type-id='1' {if $sel_value== 56}selected{/if}>PET</option>
				<option value='4' data-type-id='1' {if $sel_value== 4}selected{/if}>LLDPE</option>
				<option value='1' data-type-id='1' {if $sel_value== 1}selected{/if}>ABS</option>
				<option value='7' data-type-id='1' {if $sel_value== 7}selected{/if}>HIPS</option>
				<option value='3' data-type-id='1' {if $sel_value== 3}selected{/if}>HDPE</option>
				<option value='9' data-type-id='2' {if $sel_value== 9}selected{/if}>PC</option>
				<option value='2' data-type-id='1' {if $sel_value== 2}selected{/if}>GPPS</option>
			</select>-->
			<span >{$tab}</span >
			<input type='hidden' name='data[product_name_new_text][]' value='{$tab}'>
			<input type='hidden' name='data[product_name_new][]' value='{$sel_value}'>
		</td>
		<td style="width: 150px">
			<select name="data[factory_name_new][]" class="form-control input-sm search-options select2" required>
				<option value="">选择厂家</option>
				{loop $factory $vv}
				<option value="{$vv['id']}" data-type-id="{$type_id}">{$vv['name']}</option>
				{/loop}
			</select>
			<input type='hidden' name='data[factory_name_new_text][]' value=''>
		</td>
		<td class="">
			<select name="data[brand_name_new][]" class="form-control input-sm search-options select2" required>
				<option value="">选择牌号</option>
			</select>
			<input type='hidden' name='data[brand_name_new_text][]' value=''>
		</td>
		<td class="">
			<!--<input type="text" dtype="value" min-value="0.01" max-value="9999999.99" name="data[yesterday_new][]"  maxlength="11">-->
		</td>
		<td class="">
			<input type="text" dtype="value" min-value="0.01" max-value="9999999.99" name="data[today_new][]" required
				   maxlength="11">
		</td>
		<td class="">
			<a href="javascript:;" class="btn btn-danger btn-xs delete_self">
				<i class="glyphicon glyphicon-trash"></i> 删除</a>
		</td>
	</tr>
</script>

<script>
	seajs.use("quotedata", function(exports) {
		exports.init({
            insert_url : '{$insert_url}',
            sel_val:'{$sel_value}'
		});
	});
</script>
</body>
</html>
